package com.example.demo.service.impl;

import com.example.demo.entity.DTO.FosterDTO;
import com.example.demo.entity.Foster;
import com.example.demo.mapper.FosterMapper;
import com.example.demo.service.IFosterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 寄养表 服务实现类
 * </p>
 *
 * @author Mr.sdy
 * @since 2024-06-05
 */
@Service
public class FosterServiceImpl extends ServiceImpl<FosterMapper, Foster> implements IFosterService {
    @Autowired
    private FosterMapper fosterMapper;
    @Override
    public boolean insert(Foster foster) {
        if(fosterMapper.insert(foster) > 0){
            return true;
        }
        return false;
    }

    @Override
    public List<FosterDTO> selectFostersByUserId(Integer userId) {
        return fosterMapper.selectFostersByUserId(userId);
    }
}
